package Lambda;

import collection.Point;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class LambdaDemo01 {
    public static void main(String[] args) {
        Point p1 = new Point(10,20);
        Point p2 = new Point(30,40);
        List<Point> list = new ArrayList<>();
        list.add(p1);
        list.add(p2);
        //调用Collections,sort(List<T> list,Comparator cc)方法对Point对象排序
        //Lambda表达式的基本应用
        Collections.sort(list,(o1, o2)->o1.getX()-o2.getX());
    }
}
